import type { AppRouteObject } from "types/router";
import { Suspense } from "react";
import { Navigate, Outlet } from "react-router-dom";
import MenuSetting from "@/pages/settings/MenuSetting";
import { SettingOutlined, MenuOutlined } from "@ant-design/icons";

const Settings: AppRouteObject = {
  order: 2,
  path: "settings",
  element: (
    <Suspense fallback={<div>Loading...</div>}>
      <Outlet />
    </Suspense>
  ),
  meta: {
    title: "系统管理",
    icon: <SettingOutlined />,
    key: "/settings",
  },
  children: [
    {
      index: true,
      element: <Navigate to="menu" replace />,
    },
    {
      path: "menu",
      element: <MenuSetting />,
      meta: {
        title: "菜单管理",
        key: "/settings/menu",
        icon: <MenuOutlined />,
      },
    },
  ],
};

export default Settings;
